package com.test;

/**
 * Created by 41579 on 2017/4/16.
 */
public class ThreadLocalRunnable implements Runnable{
    ThreadLocal<Integer> i = new ThreadLocal<Integer>();
    Integer k = 0;
    @Override
    public void run() {
        i.set(0);
        for(int j=0;j<100;j++){
            i.set(i.get()+1);
            Thread.yield();
//            k++;
        }
        System.out.println(Thread.currentThread().getName()+" i is:"+i.get());
//        System.out.println(Thread.currentThread().getName()+" k is:"+k);
    }
}
